/*
 * 根据配置文件生成  JSP文件
 * 
 * VERSION  DATE        BY              REASON
 * -------- ----------- --------------- ------------------------------------------
 * 1.00     2014.07.24  wuxiaogang      程序・发布
 * -------- ----------- --------------- ------------------------------------------
 * Copyright 2014 easycode System. - All Rights Reserved.
 *
 */
package cn.com.softvan.easycode.utils;

import java.io.File;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import cn.com.softvan.common.DbTypeUtils;
import cn.com.softvan.common.StrUtils;
import cn.com.softvan.common.Validator;
import cn.com.softvan.easycode.bean.ColumsBean;
import cn.com.softvan.easycode.bean.ConfigBean;
import cn.com.softvan.easycode.bean.TableBean;
/**
 * 根据配置文件生成  JSP文件
 * @author wuxiaogang 
 *
 */
public class JspUtils {
	private static SimpleDateFormat sdf=new SimpleDateFormat("yyyy.MM.dd");
	
	private static String strutsNamespace="";
	private static int len=8;
	/**
	 * 生成 jsp
	 * @param config
	 * @param leftMenu
	 * @return
	 */
	public static StringBuffer toFile(ConfigBean config,List<String> leftMenuList){
		try {
			len=Integer.parseInt(config.getJsplen());
		} catch (Exception e1) {
		}
		StringBuffer csb=new StringBuffer("");
		try {
			if(null==config){
				return csb;
			}
			if(Validator.notEmpty(config.getStrutsNamespace())){
				strutsNamespace=config.getStrutsNamespace();
			}
			//TODO 获取表列表
			List<TableBean> tables=config.getTables();
			if(null==tables){
				return csb;
			}
			for(TableBean table:tables){
				try {
					//action类名
					String actionName="";
					//是否生成jsp 0否 1是
					String isJsp=config.getIsJsp();
					if(Validator.notEmpty(table.getIsJsp())){
						isJsp=table.getIsJsp();
					}
					if("0".equals(isJsp)){
						continue;
					}
					if(Validator.isEmpty(table.getClassName())){
						actionName=StrUtils.toUpperCase(table.getTableName(),"_")+"Action";
					}else{
						actionName=table.getClassName()+"Action";
					}
					if(Validator.notEmpty(table.getActionName())){
						actionName=table.getActionName();
					}
					//TODO 生成初始化init页面
					toFileInitJsp(config, table, actionName,leftMenuList);
					//TODO 生成初始化init页面 信息列表
					toFileInitListJsp(config, table, actionName);
					//TODO 生成编辑edit页面
					toFileEditJsp(config, table, actionName);
//					//TODO 生成回收站recycle页面
//					toFileRecycleJsp(config, table, actionName,leftMenuList);
//					//TODO 生成回收站recycle页面  信息列表
//					toFileRecycleListJsp(config, table, actionName);
					
					String package_name="";
					if(Validator.notEmpty(config.getThisJspDir())){
						package_name=StrUtils.replaceAll(config.getThisJspDir(), "\\.","/");
					}else{
						package_name=config.getActionPackage().substring(config.getActionPackage().lastIndexOf(".")+1,config.getActionPackage().length());
					}
					//TODO 生成配置文件信息
					csb.append("\n\t\t<!-- "+table.getTableNote()+" 管理 -->	");
					csb.append("\n\t\t<action name=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"*\" class=\""+StrUtils.toLowerCaseFirstOne(actionName)+"\" method=\"{1}\">	");
					csb.append("\n\t\t\t<result name=\"init\">/WEB-INF/pages/admin/"+package_name+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+".jsp</result>	");
					csb.append("\n\t\t\t<result name=\"edit\">/WEB-INF/pages/admin/"+package_name+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_01.jsp</result>	");
					csb.append("\n\t\t\t<result name=\"infoList\">/WEB-INF/pages/admin/"+package_name+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_list.jsp</result>	");
//					csb.append("\n\t\t\t<result name=\"view\">/WEB-INF/pages/admin/"+package_name+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_02.jsp</result>	");
//					csb.append("\n\t\t\t<result name=\"recycle\">/WEB-INF/pages/admin/"+package_name+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_03.jsp</result>	");
//					csb.append("\n\t\t\t<result name=\"recyclelist\">/WEB-INF/pages/admin/"+package_name+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_03_list.jsp</result>	");
					csb.append("\n\t\t\t<result name=\"success\" type=\"chain\">"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"init</result>	");
					csb.append("\n\t\t</action>	");
					
					
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return csb;
	}
	/**
	 * 生成 jsp 初始化页面
	 * @param config
	 * @return
	 */
	public static StringBuffer toFileInitJsp(ConfigBean config,TableBean table,String actionName,List<String> leftMenuList){
		try {
			len=Integer.parseInt(config.getJsplen());
		} catch (Exception e1) {
		}
		
		String includeDir="../";
		if(Validator.notEmpty(config.getThisJspDir())){
			int n=config.getThisJspDir().indexOf(".");
			for(int i=0;i<n-1;i++){
				includeDir+="../";
			}
		}
		
		StringBuffer sb=new StringBuffer("");
		sb.append("<%--");
		sb.append("\n/*");
		sb.append("\n * "+table.getTableNote()+" 后台管理 (初始化页面)");
		sb.append("\n *");
		sb.append("\n * VERSION  DATE\t\tBY\t\t   REASON");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * 1.00\t "+sdf.format(new Date())+"  "+config.getAuther()+"   程序.发布");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * "+config.getCopyright());
		sb.append("\n *");
		sb.append("\n */");
		sb.append("\n--%>");
		sb.append("\n<%@ page language=\"java\" contentType=\"text/html; charset=utf-8\" pageEncoding=\"utf-8\" session=\"false\"%>");
		sb.append("\n<%@ include file=\"../include/public_tags.jsp\" %>");
		sb.append("\n<!DOCTYPE html>");
		
		sb.append("\n<!--[if IE 8]> <html lang=\"zh-CN\" class=\"ie8 no-js\"> <![endif]--><!--[if IE 9]> <html lang=\"zh-CN\" class=\"ie9 no-js\"> <![endif]--><!--[if !IE]><!--> <html lang=\"zh-CN\" class=\"no-js\"> <!--<![endif]-->");
		sb.append("\n<head>");
		sb.append("\n<meta charset=\"utf-8\" />");
		sb.append("\n<%@ include file=\""+includeDir+"include/meta.jsp\" %>");
		sb.append("\n<%@ include file=\""+includeDir+"include/admin_title.jsp\" %>");
		sb.append("\n<%@ include file=\""+includeDir+"include/public_init_js_css.jsp\" %>");
		
//		sb.append("\n<link rel=\"stylesheet\" href=\"${basePath}/plugins/bootstrapvalidator/vendor/bootstrap/css/bootstrap.css\"/>");
//		sb.append("\n");
//		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrapvalidator/vendor/jquery/jquery-1.10.2.min.js\"></script>");
//		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrapvalidator/vendor/bootstrap/js/bootstrap.min.js\"></script>");
		sb.append("\n");
		sb.append("\n</head>");
		sb.append("\n<!-- END HEAD -->");
		sb.append("\n<!-- BEGIN BODY -->");
		sb.append("\n<body class=\"page-header-fixed\">");
		sb.append("\n\t<!-- BEGIN HEADER -->");
		sb.append("\n\t<%@ include file=\""+includeDir+"include/header.jsp\"%>");
		sb.append("\n\t<!-- END HEADER -->");
		sb.append("\n\t<div class=\"clearfix\"></div>");
		sb.append("\n\t<!-- BEGIN CONTAINER -->");
		sb.append("\n\t<div class=\"page-container\">");
		
		sb.append("\n\t<!-- BEGIN SIDEBAR MENU -->        ");
//		sb.append("\n\t<ul class=\"page-sidebar-menu\">");
		StringBuffer leftMenu=new StringBuffer();
//		leftMenu.append("\n\t\t<li id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"\" class=\"\">");
//		leftMenu.append("\n\t\t\t<a class=\"active\" href=\"javascript:;\">");
//		leftMenu.append("\n\t\t\t<i class=\"fa fa-cogs\"></i> ");
//		leftMenu.append("\n\t\t\t<span class=\"title\">"+table.getTableNote()+"</span>");
//		leftMenu.append("\n\t\t\t<span id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_arrow\" class=\"arrow\"></span>");
//		leftMenu.append("\n\t\t\t</a>");
//		leftMenu.append("\n\t\t\t<ul id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu\" style=\"display: none;\" class=\"sub-menu\">");
		leftMenu.append("\n\t\t\t\t<shiro:hasPermission name=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+":init\">");;
		leftMenu.append("\n\t\t\t\t<li id=\""+config.getThisJspDir()+"_sub_menu_"+(leftMenuList.size()+1)+"\"><a href=\"${basePath }/h/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"init.ac\">"+table.getTableNote()+"</a></li>");
		leftMenu.append("\n\t\t\t\t</shiro:hasPermission>");
//		leftMenu.append("\n\t\t\t\t<li id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu_l2\"><a href=\"${basePath }/h/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"recycle.ac\">信息回收站</a></li>");
//		leftMenu.append("\n\t\t\t</ul>");
//		leftMenu.append("\n\t\t</li>");
		leftMenuList.add(leftMenu.toString());
//		sb.append(leftMenu);
//		sb.append("\n\t</ul>");
		sb.append("\n\t\t<%@ include file=\""+includeDir+"include/leftMenu.jsp\"%>");
		sb.append("\n\t<!-- END SIDEBAR MENU -->");
		
		sb.append("\n\t\t<script type=\"text/javascript\">");
		sb.append("\n\t\t\tjQuery(document).ready(function() {");
		sb.append("\n\t\t\t\t$('#"+config.getThisJspDir()+",#"+config.getThisJspDir()+"_sub_menu_"+(leftMenuList.size())+"').addClass('active');");
		sb.append("\n\t\t\t\t$('#"+config.getThisJspDir()+"_arrow').addClass('open');");
		sb.append("\n\t\t\t\t$('#"+config.getThisJspDir()+"_sub_menu').show();");
		sb.append("\n\t\t\t});");
		sb.append("\n\t\t</script>");
		
		sb.append("\n\t<!-- BEGIN PAGE -->");
		sb.append("\n\t<div class=\"page-content\">");
		sb.append("\n\t<!-- BEGIN STYLE CUSTOMIZER -->");
		sb.append("\n\t<%@ include file=\""+includeDir+"include/style_customizer.jsp\"%>");
		sb.append("\n\t<!-- END BEGIN STYLE CUSTOMIZER -->");
		sb.append("\n\t\t<!-- BEGIN PAGE HEADER-->");
		sb.append("\n\t\t<div class=\"row\">");
		sb.append("\n\t\t\t<div class=\"col-md-12\">");
		sb.append("\n\t\t\t\t<!-- BEGIN PAGE TITLE & BREADCRUMB-->");
		sb.append("\n\t\t\t\t<h3 class=\"page-title\">");
		sb.append("\n\t\t\t\t\t"+table.getTableNote()+"管理 <small><span class=\"help-inline\">在这里你可以查看未删除的信息</span></small>");
		sb.append("\n\t\t\t\t</h3>");
		sb.append("\n\t\t\t\t<ul class=\"page-breadcrumb breadcrumb\">");
		sb.append("\n\t\t\t\t\t<li><i class=\"fa fa-home\"></i> <a");
		sb.append("\n\t\t\t\t\t\thref=\"${basePath }/h/index.ac\">主页</a> <i");
		sb.append("\n\t\t\t\t\t\tclass=\"fa fa-angle-right\"></i></li>");
		sb.append("\n\t\t\t\t\t<li><a href=\"${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"init.ac\">"+table.getTableNote()+"管理</a> <i class=\"fa fa-angle-right\"></i></li>");
		sb.append("\n\t\t\t\t\t<li>列表</li>");
		sb.append("\n\t\t\t\t</ul>");
		sb.append("\n\t\t\t\t<!-- END PAGE TITLE & BREADCRUMB-->");
		sb.append("\n\t\t\t</div>");
		sb.append("\n\t\t</div>");
		sb.append("\n\t\t<!-- END PAGE HEADER-->");
		sb.append("\n");
		sb.append("\n\t\t<!-- BEGIN PAGE CONTENT-->");
		sb.append("\n<!-- BEGIN PAGE CONTENT-->");
		sb.append("\n<div class=\"row\">");
		sb.append("\n\t<div class=\"col-md-12\">");
		sb.append("\n\t\t<div class=\"matter\">");
		
		sb.append("\n\t\t\t<c:if test=\"${msg!=null}\">");
		sb.append("\n\t\t\t<c:choose>");
		sb.append("\n\t\t\t<c:when test=\"${msg!='1'}\">");
		sb.append("\n\t\t\t		<div class=\"alert alert-danger\">");
		sb.append("\n\t\t\t			<button class=\"close\" data-dismiss=\"alert\"></button>");
		sb.append("\n\t\t\t			<strong>Error!</strong> ${msg}");
		sb.append("\n\t\t\t		</div>");
		sb.append("\n\t\t\t	</c:when>");
		sb.append("\n\t\t\t	<c:otherwise>");
		sb.append("\n\t\t\t		<div class=\"alert alert-success\">");
		sb.append("\n\t\t\t			<button class=\"close\" data-dismiss=\"alert\"></button>");
		sb.append("\n\t\t\t			<strong>Success!</strong> 操作成功。");
		sb.append("\n\t\t\t		</div>");
		sb.append("\n\t\t\t	</c:otherwise>");
		sb.append("\n\t\t\t</c:choose>");
		sb.append("\n\t\t\t</c:if>");
		sb.append("\n\t\t\t<div id=\"msg\"></div>");
		//数据检索框
		sb.append("\n\t\t\t<div class=\"form-actions\">");
		sb.append("\n\t\t\t\t<form id=\"info_search_form\" method=\"post\" class=\"form-horizontal\" accept-charset=\"UTF-8\"  action=\"${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"infoList.ac\">");
		sb.append("\n\t\t\t\t\t<input type=\"hidden\" name=\"bean.offset\" id=\"offsetA\" value=\"${bean.offset}\">");
		sb.append("\n\t\t\t\t\t<div class=\"row clearfix\">");
		sb.append("\n\t\t\t\t\t\t<div class=\"input-group col-xs-12 col-sm-6 col-md-4 col-lg-3 mt10\">");
		sb.append("\n\t\t\t\t\t\t\t<span class=\"input-group-addon\">");
		sb.append("\n\t\t\t\t\t\t\t字段示例");
		sb.append("\n\t\t\t\t\t\t\t</span>");
		sb.append("\n\t\t\t\t\t\t\t<input placeholder=\"检索字段示例\" class=\"form-control\" name=\"bean.errcode\" value=\"\" type=\"text\">");
		sb.append("\n\t\t\t\t\t\t</div>");
		sb.append("\n\t\t\t\t\t\t<div class=\"input-group col-xs-12 col-sm-6 col-md-4 col-lg-3 mt10\">");
		sb.append("\n\t\t\t\t\t\t\t   <span class=\"input-group-addon\">");
		sb.append("\n\t\t\t\t\t\t\t\t\t起始时间");
		sb.append("\n\t\t\t\t\t\t\t   </span>");
		sb.append("\n\t\t\t\t\t\t\t   <input placeholder=\"检索起始时间\" name=\"bean.date1\" value=\"${bean.date1}\"  type=\"text\" class=\"form-control laydate-icon\"  readonly=\"readonly\" onclick=\"laydate({istime: true, festival: true, istoday: true, format: 'YYYY-MM-DD hh:mm:ss'})\" />");
		sb.append("\n\t\t\t\t\t\t</div>");
		sb.append("\n\t\t\t\t\t\t<div class=\"input-group col-xs-12 col-sm-6 col-md-4 col-lg-3 mt10\">");
		sb.append("\n\t\t\t\t\t\t\t   <span class=\"input-group-addon\">");
		sb.append("\n\t\t\t\t\t\t\t\t\t终止时间");
		sb.append("\n\t\t\t\t\t\t\t   </span>");
		sb.append("\n\t\t\t\t\t\t\t   <input placeholder=\"检索终止时间\" name=\"bean.date2\" value=\"${bean.date2}\"  type=\"text\" class=\"form-control laydate-icon\"  readonly=\"readonly\" onclick=\"laydate({istime: true, festival: true, istoday: true, format: 'YYYY-MM-DD hh:mm:ss'})\" />");
		sb.append("\n\t\t\t\t\t\t</div>");
		sb.append("\n\t\t\t\t\t\t<div class=\"input-group col-xs-12 col-sm-6 col-md-4 col-lg-3 mt10\">");
		sb.append("\n\t\t\t\t\t\t\t<div style=\"width: 125px;margin:0px auto 0 auto;\">");
		sb.append("\n\t\t\t\t\t\t\t\t<input class=\"btn default green-stripe\" type=\"button\" onclick=\"loadUrlPage(null,'info_search_form','info_list_div');\" value=\"检索\" />  <input class=\"btn default dark-stripe\" type=\"reset\" value=\"重置\" />");
		sb.append("\n\t\t\t\t\t\t\t</div>");
		sb.append("\n\t\t\t\t\t\t</div>");
		sb.append("\n\t\t\t\t\t</div>");

		sb.append("\n\t\t\t\t</form>");
		sb.append("\n\t\t\t</div>");
		sb.append("\n\t\t\t<div class=\"mt10 clearfix\"></div>");
		//新增按钮
		sb.append("\n\t\t\t<shiro:hasPermission name=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+":add\"> ");
		sb.append("\n\t\t\t<a href=\"javascript:;\"  onclick=\"openMyBoxLayer('a','${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"edit.ac')\" class=\"label label-primary\"><i class=\"fa fa-plus\"></i> 新增</a>");
		sb.append("\n\t\t\t</shiro:hasPermission>");
		//数据列表div
		sb.append("\n\t\t\t<div id=\"info_list_div\">");
		sb.append("\n\t\t\t\t<div class=\"alert alert-warning mt10\">");
		sb.append("\n\t\t\t\t\t<strong>数据加载中!</strong>data loading...");
		sb.append("\n\t\t\t\t</div>");
		sb.append("\n\t\t\t</div>");
		
		
//		sb.append("\n\t\t\t<table class=\"table table-striped table-bordered table-hover\" id=\"table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"\">");
//		sb.append("\n\t\t\t\t<thead>");
//		sb.append("\n\t\t\t\t\t<tr>");
//		StringBuffer thsb=null;
//		StringBuffer tdsb=null;
//		int showcolumnssize=2;
//		//需要使用js排序的td字段
//		StringBuffer tdsort=null;
//		if(table.getShowColumns()!=null){
//			thsb=new StringBuffer();
//			tdsb=new StringBuffer();
//			tdsort=new StringBuffer();
//			for(ColumsBean col:table.getShowColumns()){
//				if(col!=null){
//					thsb.append("\n\t\t\t\t\t\t<th class=\"col-md-"+(Validator.isIntNumber(col.getColmd())?col.getColmd():"1")+"\">"+col.getName()+"</th>");
//					tdsb.append("\n\t\t\t\t\t\t<td>${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),col.getDbcolumns()))+"}</td>");
//					++showcolumnssize;
//					tdsort.append("null");
//					if(showcolumnssize-2<table.getShowColumns().size()-1){
//						tdsort.append(",");
//					}
//				}
//			}
//		}
//		sb.append("\n\t\t\t\t\t\t<th class=\"col-md-1 table-checkbox\"><input type=\"checkbox\" class=\"group-checkable\" data-set=\"#table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+" .checkboxes\" /></th>");
//		sb.append(thsb);
//		sb.append("\n\t\t\t\t\t\t<th class=\"col-md-1\"></th>");
//		sb.append("\n\t\t\t\t\t</tr>");
//		sb.append("\n\t\t\t\t</thead>");
//		sb.append("\n\t\t\t\t<tbody>");
//		sb.append("\n\t\t\t<c:choose>");
//		sb.append("\n\t\t\t\t<c:when test=\"${beans!=null && fn:length(beans)>0}\">");
//		sb.append("\n\t\t\t\t<c:forEach items=\"${beans}\" var=\"bean\">");
//		sb.append("\n\t\t\t\t\t<tr class=\"odd gradeX\">");
//		//TODO 获取表字段列表
//		List<ColumsBean> columsBeans=table.getColums();
//		if(columsBeans==null){
//			columsBeans=new ArrayList<ColumsBean>();
//		}
//		//--主键字段列表--
//		List<ColumsBean> pkColumsBeans=new ArrayList<ColumsBean>();
//		//-----1-字段列表------
//		for(int i=0;i<columsBeans.size();i++){
//			ColumsBean colums=columsBeans.get(i);
//			//是否主键
//			if("PRI".equals(StrUtils.toUpperCase(colums.getColumsKey()))){
//				pkColumsBeans.add(colums);
//			}
//		}
//		String strpk="";
//		String str="";
//		if(pkColumsBeans!=null && pkColumsBeans.size()>0){
//			int i=0;
//			for(ColumsBean columsBean:pkColumsBeans){
//				strpk+="${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}";
//				str+=(StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"=${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}");
//				if(i<pkColumsBeans.size()-1){
//					strpk+=("&");
//					str+=("&");
//				}
//				i++;
//			}
//		}else{
//			str+=("id=${bean.id}");
//		}
//		sb.append("\n\t\t\t\t\t\t<td><input name=\"pk\" type=\"checkbox\" class=\"checkboxes\" value=\""+strpk+"\" /></td>");
//		sb.append(tdsb);
//		sb.append("\n\t\t\t\t\t\t<td>");
//		//sb.append("\n\t\t\t\t\t\t<a href=\"${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"view.ac?"+str+"\" class=\"btn  btn-info\" target=\"_blank\">预览</a>");
//		sb.append("\n\t\t\t\t\t\t<a href=\"javascript:;\"  onclick=\"openMyBoxLayer('e','${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"edit.ac?"+str+"');\" class=\"label label-success\"><i class=\"fa fa-edit\"> 编辑</a>");
//		sb.append("\n\t\t\t\t\t\t<a href=\"javascript:;\" class=\"label label-danger\" onclick=\"if(confirm('确认删除吗?')){delInfoData('${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"del.ac?"+str+"');};\" rel=\"nofollow\"><i class=\"fa fa-trash-o\"></i> 删除</a>");
//		sb.append("\n\t\t\t\t\t\t</td>");
//		sb.append("\n\t\t\t\t\t</tr>");
//		sb.append("\n\t\t\t\t\t</c:forEach>");
//		sb.append("\n\t\t\t\t	</c:when>");
//		sb.append("\n\t\t\t\t	<c:otherwise>");
//		sb.append("\n\t\t\t\t	<tr>");
//		sb.append("\n\t\t\t\t		<td class=\"col-md-8\" colspan=\""+showcolumnssize+"\">");
//		sb.append("\n\t\t\t\t			<div class=\"alert\"><strong>暂无数据!</strong></div>");
//		sb.append("\n\t\t\t\t		</td>");
//		sb.append("\n\t\t\t\t	</tr>");
//		sb.append("\n\t\t\t\t	</c:otherwise>");
//		sb.append("\n\t\t\t</c:choose>");
//		sb.append("\n\t\t\t\t</tbody>");
//		sb.append("\n\t\t\t</table>");
//		sb.append("\n\t\t\t<customtag:pagingext func=\"loadUrlPage\" params=\"'"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"init'\" />");
		sb.append("\n\t\t</div>");
		sb.append("\n\t</div>");
		sb.append("\n</div>");
		sb.append("\n<!-- END PAGE CONTENT-->");
		sb.append("\n\t</div>");
		sb.append("\n\t</div>");
		sb.append("\n\t<!-- BEGIN FOOTER -->");
		sb.append("\n\t<%@ include file=\""+includeDir+"include/footer.jsp\"%>");
		sb.append("\n\t<!-- END FOOTER -->");
		sb.append("\n<%@ include file=\""+includeDir+"include/public_last_js_css.jsp\"%>");
		sb.append("\n<script type=\"text/javascript\">");
		sb.append("\n$(document).ready(function() {\n//js code ");
		//js排序控件初始化
//		sb.append("\n //表格排序功能  参数1:表格id 参数2:json格式 哪些列不参与排序 null为参与  参数3:数组 隐藏列[0,1]表示隐藏1,2列");
//		sb.append("\n myTableManaged.init('table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"',[{ 'bSortable': false },"+tdsort+",{ 'bSortable': false }],[]);");
		//ajax 加载
		sb.append("\n //初始加载..");
		sb.append("\n loadUrlPage(null,'info_search_form','info_list_div');");
		sb.append("\n});");
//		sb.append("\nfunction loadUrlPage(offset, url) {");
//		sb.append("\n\tlocation.href='${basePath}' + url +'.ac?offset=' + offset;");
//		sb.append("\n}");
		sb.append("\n</script>");
		sb.append("\n</body>");
		sb.append("\n<!-- END BODY -->");
		sb.append("\n</html>");
		
		try {
			String package_name="";
			if(Validator.notEmpty(config.getThisJspDir())){
				package_name=StrUtils.replaceAll(config.getThisJspDir(), "\\.","/");
			}else{
				package_name=config.getActionPackage().substring(config.getActionPackage().lastIndexOf(".")+1,config.getActionPackage().length());
			}
			//文件保存路径 项目根目录+包路径+类名称
			String fileurl=config.getWebAppDir()+"/WEB-INF/pages/admin/"+package_name+"/";
			//创建文件夹
			File saveDirFile = new File(fileurl);
			if (!saveDirFile.exists()) {
				saveDirFile.mkdirs();
			}
//			try {
//				//写入文件
//				PrintWriter pw=new PrintWriter(fileurl+"/"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"_left.txt","utf8");
//				pw.write(leftMenu.toString());
//				pw.close();
//			} catch (Exception e1) {
//			}
			//写入文件
			PrintWriter pw=new PrintWriter(fileurl+"/"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+".jsp","utf8");
			pw.write(sb.toString());
			pw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return sb;
	}
	/**
	 * 生成 jsp 初始化页面  列表
	 * @param config
	 * @return
	 */
	public static StringBuffer toFileInitListJsp(ConfigBean config,TableBean table,String actionName){
		try {
			len=Integer.parseInt(config.getJsplen());
		} catch (Exception e1) {
		}
//		String includeDir="../";
//		if(Validator.notEmpty(config.getThisJspDir())){
//			int n=config.getThisJspDir().indexOf(".");
//			for(int i=0;i<n-1;i++){
//				includeDir+="../";
//			}
//		}
		StringBuffer sb=new StringBuffer("");
		sb.append("<%--");
		sb.append("\n/*");
		sb.append("\n * "+table.getTableNote()+" 后台管理 (初始化页面  信息列表)");
		sb.append("\n *");
		sb.append("\n * VERSION  DATE\t\tBY\t\t   REASON");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * 1.00\t "+sdf.format(new Date())+"  "+config.getAuther()+"   程序.发布");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * "+config.getCopyright());
		sb.append("\n *");
		sb.append("\n */");
		sb.append("\n--%>");
		sb.append("\n<%@ page language=\"java\" contentType=\"text/html; charset=utf-8\" pageEncoding=\"utf-8\" session=\"false\"%>");
		sb.append("\n<%@ include file=\"../include/public_tags.jsp\" %>");
		sb.append("\n\t<!-- BEGIN PAGE -->");
		sb.append("\n\t\t<div class=\"matter\">");
		sb.append("\n\t\t\t<table class=\"table table-striped table-bordered table-hover\" id=\"table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"\">");
		sb.append("\n\t\t\t\t<thead>");
		sb.append("\n\t\t\t\t\t<tr>");
		StringBuffer thsb=null;
		StringBuffer tdsb=null;
		int showcolumnssize=2;
		//需要使用js排序的td字段
		//字段列表map 方便比较
		Set<String> columsSet=new HashSet<String>();
		//TODO 获取表字段列表
		List<ColumsBean> columsBeans=table.getColums();
		if(columsBeans==null){
			columsBeans=new ArrayList<ColumsBean>();
		}
		//可以显示的 列数量
		int showColumsNum=0;
		for(ColumsBean col:columsBeans){
			columsSet.add(col.getColumsName().toString());
		}
		StringBuffer tdsort=null;
		if(table.getShowColumns()!=null){
			for(ColumsBean col:table.getShowColumns()){
				if(col!=null && col.getDbcolumns()!=null && columsSet.contains(col.getDbcolumns().toLowerCase())){
					++showColumsNum;
				}
			}
			thsb=new StringBuffer();
			tdsb=new StringBuffer();
			tdsort=new StringBuffer();
			for(ColumsBean col:table.getShowColumns()){
				if(col!=null && col.getDbcolumns()!=null && columsSet.contains(col.getDbcolumns().toLowerCase())){
					thsb.append("\n\t\t\t\t\t\t<th class=\"col-md-"+(Validator.isIntNumber(col.getColmd())?col.getColmd():"1")+"\">"+col.getName()+"</th>");
					tdsb.append("\n\t\t\t\t\t\t<td>${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),col.getDbcolumns()))+"}</td>");
					tdsort.append("null");
					if(showcolumnssize-2<showColumsNum-1){
						tdsort.append(",");
					}
					++showcolumnssize;
				}
			}
		}
		sb.append("\n\t\t\t\t\t\t<th class=\"col-md-1 table-checkbox\"><!--<input type=\"checkbox\" class=\"group-checkable\" data-set=\"#table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+" .checkboxes\" />--></th>");
		sb.append(thsb);
		sb.append("\n\t\t\t\t\t\t<th class=\"col-md-1\"></th>");
		sb.append("\n\t\t\t\t\t</tr>");
		sb.append("\n\t\t\t\t</thead>");
		sb.append("\n\t\t\t\t<tbody>");
		sb.append("\n\t\t\t\t<c:choose>");
		sb.append("\n\t\t\t\t<c:when test=\"${beans!=null && fn:length(beans)>0}\">");
		sb.append("\n\t\t\t\t<c:forEach items=\"${beans}\" var=\"bean\">");
		sb.append("\n\t\t\t\t\t<tr class=\"odd gradeX\">");
		//--主键字段列表--
		List<ColumsBean> pkColumsBeans=new ArrayList<ColumsBean>();
		//-----1-字段列表------
		for(int i=0;i<columsBeans.size();i++){
			ColumsBean colums=columsBeans.get(i);
			//是否主键
			if("PRI".equals(StrUtils.toUpperCase(colums.getColumsKey()))){
				pkColumsBeans.add(colums);
			}
		}
		String strpk="";
		String str="";
		if(pkColumsBeans!=null && pkColumsBeans.size()>0){
			int i=0;
			for(ColumsBean columsBean:pkColumsBeans){
				strpk+="${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}";
				str+=(StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"=${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}");
				if(i<pkColumsBeans.size()-1){
					strpk+=("&");
					str+=("&");
				}
				i++;
			}
		}else{
			str+=("id=${bean.id}");
		}
		sb.append("\n\t\t\t\t\t\t<td><!--<input name=\"pk\" type=\"checkbox\" class=\"checkboxes\" value=\""+strpk+"\" />--></td>");
		sb.append(tdsb);
		sb.append("\n\t\t\t\t\t\t<td>");
		//sb.append("\n\t\t\t\t\t\t<a href=\"${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"view.ac?"+str+"\" class=\"btn  btn-info\" target=\"_blank\">预览</a>");
		sb.append("\n\t\t\t\t\t\t<shiro:hasPermission name=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+":edit\"> ");
		sb.append("\n\t\t\t\t\t\t<a href=\"javascript:;\"  onclick=\"openMyBoxLayer('e','${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"edit.ac?"+str+"');\" class=\"label label-success\" ><i class=\"fa fa-edit\"></i> 编辑</a>");
		sb.append("\n\t\t\t\t\t\t</shiro:hasPermission>");
		sb.append("\n\t\t\t\t\t\t<shiro:hasPermission name=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+":del\"> ");
		sb.append("\n\t\t\t\t\t\t<a href=\"javascript:;\"  onclick=\"if(confirm('确认删除吗?')){delInfoData('${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"del.ac?"+str+"');};\" rel=\"nofollow\" class=\"label label-danger\" ><i class=\"fa fa-trash-o\"></i> 删除</a>");
		sb.append("\n\t\t\t\t\t\t</shiro:hasPermission>");
		sb.append("\n\t\t\t\t\t\t</td>");
		sb.append("\n\t\t\t\t\t</tr>");
		sb.append("\n\t\t\t\t\t</c:forEach>");
		sb.append("\n\t\t\t\t	</c:when>");
		sb.append("\n\t\t\t\t	<c:otherwise>");
		sb.append("\n\t\t\t\t	<tr>");
		sb.append("\n\t\t\t\t		<td class=\"col-md-8\" colspan=\""+showcolumnssize+"\">");
		sb.append("\n\t\t\t\t			<div class=\"alert\"><strong>暂无数据!</strong></div>");
		sb.append("\n\t\t\t\t		</td>");
		sb.append("\n\t\t\t\t	</tr>");
		sb.append("\n\t\t\t\t	</c:otherwise>");
		sb.append("\n\t\t\t\t</c:choose>");
		sb.append("\n\t\t\t\t</tbody>");
		sb.append("\n\t\t\t</table>");
		sb.append("\n\t\t\t<customtag:pagingext func=\"loadUrlPage\" params=\"'info_search_form','info_list_div'\" />");
		sb.append("\n\t\t</div>");
		sb.append("\n\t</div>");
		sb.append("\n</div>");
		sb.append("\n<!-- END PAGE CONTENT-->");
		sb.append("\n<script type=\"text/javascript\">");
		sb.append("\n$(document).ready(function() {\n//js code \n");
		//js排序控件初始化
		sb.append("\n //判断表格中是否有数据");
		sb.append("\n <c:if test=\"${beans!=null && fn:length(beans)>0}\">");
		sb.append("\n \t//有坑提醒! 使用此功能表格必须为标准表格");
		sb.append("\n \t//表格排序功能  参数1:表格id 参数2:json格式 哪些列不参与排序 null为参与  参数3:数组 隐藏列[0,1]表示隐藏1,2列");
		sb.append("\n \tmyTableManaged.init('table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"',[{ 'bSortable': false },"+tdsort+",{ 'bSortable': false }],[]);");
		sb.append("\n </c:if>");
		sb.append("\n //判断是否尾页");
		sb.append("\n if(${PAGEROW_OBJECT_KEY.hasNext}){");
		sb.append("\n 	$('#offsetA').val(${PAGEROW_OBJECT_KEY.currOffset});");
		sb.append("\n }");
		sb.append("\n});");
		sb.append("\n</script>");
		
		try {
			String package_name="";
			if(Validator.notEmpty(config.getThisJspDir())){
				package_name=StrUtils.replaceAll(config.getThisJspDir(), "\\.","/");
			}else{
				package_name=config.getActionPackage().substring(config.getActionPackage().lastIndexOf(".")+1,config.getActionPackage().length());
			}
			//文件保存路径 项目根目录+包路径+类名称
			String fileurl=config.getWebAppDir()+"/WEB-INF/pages/admin/"+package_name+"/";
			//创建文件夹
			File saveDirFile = new File(fileurl);
			if (!saveDirFile.exists()) {
				saveDirFile.mkdirs();
			}
			//写入文件
			PrintWriter pw=new PrintWriter(fileurl+"/"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"_list.jsp","utf8");
			pw.write(sb.toString());
			pw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return sb;
	}
	/**
	 * 生成 jsp 编辑页面
	 * @param config
	 * @return
	 */
	public static StringBuffer toFileEditJsp(ConfigBean config,TableBean table,String actionName){
		try {
			len=Integer.parseInt(config.getJsplen());
		} catch (Exception e1) {
		}
		String includeDir="../";
		if(Validator.notEmpty(config.getThisJspDir())){
			int n=config.getThisJspDir().indexOf(".");
			for(int i=0;i<n-1;i++){
				includeDir+="../";
			}
		}
		StringBuffer sb=new StringBuffer("");
		//TODO 获取表字段列表
		List<ColumsBean> columsBeans=table.getColums();
		if(columsBeans==null){
			columsBeans=new ArrayList<ColumsBean>();
		}
		sb.append("<%--");
		sb.append("\n/*");
		sb.append("\n * "+table.getTableNote()+" 后台管理 (信息编辑页面)");
		sb.append("\n *");
		sb.append("\n * VERSION  DATE\t\tBY\t\t   REASON");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * 1.00\t "+sdf.format(new Date())+"  "+config.getAuther()+"   程序.发布");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * "+config.getCopyright());
		sb.append("\n *");
		sb.append("\n */");
		sb.append("\n--%>");
		sb.append("\n<%@ page language=\"java\" contentType=\"text/html; charset=utf-8\" pageEncoding=\"utf-8\" session=\"false\"%>");
		sb.append("\n<%@ include file=\"../include/public_tags.jsp\" %>");
		sb.append("\n<!DOCTYPE html>");
		sb.append("\n<!--[if IE 8]> <html lang=\"zh-CN\" class=\"ie8 no-js\"> <![endif]--><!--[if IE 9]> <html lang=\"zh-CN\" class=\"ie9 no-js\"> <![endif]--><!--[if !IE]><!--> <html lang=\"zh-CN\" class=\"no-js\"> <!--<![endif]-->");
		sb.append("\n<head>");
		sb.append("\n<meta charset=\"utf-8\" />");
		sb.append("\n<%@ include file=\""+includeDir+"include/meta.jsp\" %>");
		sb.append("\n<%@ include file=\""+includeDir+"include/admin_title.jsp\" %>");
		sb.append("\n<%@ include file=\""+includeDir+"include/public_init_js_css.jsp\" %>");
		
		sb.append("\n<link rel=\"stylesheet\" href=\"${basePath}/plugins/bootstrapvalidator/vendor/bootstrap/css/bootstrap.css\" />");
		sb.append("\n<link rel=\"stylesheet\" href=\"${basePath}/plugins/bootstrapvalidator/dist/css/bootstrapValidator.css\" />");
		sb.append("\n<link rel=\"stylesheet\" type=\"text/css\" href=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/jquery-multi-select/css/multi-select.css\" />");
		sb.append("\n<link rel=\"stylesheet\" type=\"text/css\" href=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/select2/select2_metro.css\" />");
//		sb.append("\n<link rel=\"stylesheet\" type=\"text/css\" href=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/bootstrap-datepicker/css/datepicker.css\" />");
//		sb.append("\n<link rel=\"stylesheet\" type=\"text/css\" href=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/bootstrap-datepicker/less/datepicker.less\" />");
//		sb.append("\n<link rel=\"stylesheet\" type=\"text/css\" href=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/clockface/css/clockface.css\" />");
		
		sb.append("\n");
//		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrapvalidator/vendor/jquery/jquery-1.10.2.min.js\"></script>");

		sb.append("\n");
		sb.append("\n</head>");
		sb.append("\n<!-- END HEAD -->");
		sb.append("\n<!-- BEGIN BODY -->");
		sb.append("\n<body class=\"page-header-fixed\">");
//		sb.append("\n\t<!-- BEGIN HEADER -->");
//		sb.append("\n\t<%@ include file=\""+includeDir+"include/header.jsp\"%>");
//		sb.append("\n\t<!-- END HEADER -->");
//		sb.append("\n\t<div class=\"clearfix\"></div>");
		sb.append("\n\t<!-- BEGIN CONTAINER -->");
		sb.append("\n\t<div class=\"page-container\">");
		
//		sb.append("\n\t<!-- BEGIN SIDEBAR MENU -->        ");
//		sb.append("\n\t<ul class=\"page-sidebar-menu\">");
//		sb.append("\n\t\t<li id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"\" class=\"\">");
//		sb.append("\n\t\t\t<a class=\"active\" href=\"javascript:;\">");
//		sb.append("\n\t\t\t<i class=\"fa fa-coffee\"></i> ");
//		sb.append("\n\t\t\t<span class=\"title\">"+table.getTableNote()+"</span>");
//		sb.append("\n\t\t\t<span id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_arrow\" class=\"arrow\"></span>");
//		sb.append("\n\t\t\t</a>");
//		sb.append("\n\t\t\t<ul id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu\" style=\"display: none;\" class=\"sub-menu\">");
//		sb.append("\n\t\t\t\t<li id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu_l1\"><a href=\"${basePath }/h/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"init.ac\">信息管理</a></li>");
//		sb.append("\n\t\t\t\t<li id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu_l2\"><a href=\"${basePath }/h/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"recycle.ac\">信息回收站</a></li>");
//		sb.append("\n\t\t\t</ul>");
//		sb.append("\n\t\t</li>");
//		sb.append("\n\t</ul>");
//		sb.append("\n\t\t<%@ include file=\""+includeDir+"include/leftMenu.jsp\"%>");
//		sb.append("\n\t<!-- END SIDEBAR MENU -->");
//		
//		sb.append("\n\t\t<script type=\"text/javascript\">");
//		sb.append("\n\t\t\tjQuery(document).ready(function() {");
//		sb.append("\n\t\t\t\t$('#"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+",#"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu_l1').addClass('active');");
//		sb.append("\n\t\t\t\t$('#"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_arrow').addClass('open');");
//		sb.append("\n\t\t\t\t$('#"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu').show();");
//		sb.append("\n\t\t\t});");
//		sb.append("\n\t\t</script>");
//		
//		sb.append("\n\t<!-- BEGIN PAGE -->");
//		sb.append("\n\t<div class=\"page-content\">");
//		sb.append("\n\t<!-- BEGIN STYLE CUSTOMIZER -->");
//		sb.append("\n\t<%@ include file=\""+includeDir+"include/style_customizer.jsp\"%>");
//		sb.append("\n\t<!-- END BEGIN STYLE CUSTOMIZER -->");
//		sb.append("\n\t\t<!-- BEGIN PAGE HEADER-->");
//		sb.append("\n\t\t<div class=\"row\">");
//		sb.append("\n\t\t\t<div class=\"col-md-12\">");
//		sb.append("\n\t\t\t\t<!-- BEGIN PAGE TITLE & BREADCRUMB-->");
//		sb.append("\n\t\t\t\t<h3 class=\"page-title\">");
//		sb.append("\n\t\t\t\t\t"+table.getTableNote()+"管理 <small><span class=\"help-inline\">在这里你可以编辑需要新增或修改的信息</span></small>");
//		sb.append("\n\t\t\t\t</h3>");
//		sb.append("\n\t\t\t\t<ul class=\"page-breadcrumb breadcrumb\">");
//		sb.append("\n\t\t\t\t\t<li><i class=\"fa fa-home\"></i> <a");
//		sb.append("\n\t\t\t\t\t\thref=\"${basePath }/h/index.ac\">主页</a> <i");
//		sb.append("\n\t\t\t\t\t\tclass=\"fa fa-angle-right\"></i></li>");
//		sb.append("\n\t\t\t\t\t<li><a href=\"${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"init.ac\">"+table.getTableNote()+"管理</a> <i class=\"fa fa-angle-right\"></i></li>");
//		sb.append("\n\t\t\t\t\t<li>编辑</li>");
//		sb.append("\n\t\t\t\t</ul>");
//		sb.append("\n\t\t\t\t<!-- END PAGE TITLE & BREADCRUMB-->");
//		sb.append("\n\t\t\t</div>");
//		sb.append("\n\t\t</div>");
//		sb.append("\n\t\t<!-- END PAGE HEADER-->");
//		sb.append("\n");
		sb.append("\n\t\t<!-- BEGIN PAGE CONTENT-->");
		sb.append("\n\t\t<div class=\"row\">");
		sb.append("\n\t\t\t<div class=\"col-md-12\">");
		sb.append("\n\t\t\t\t<form id=\""+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"_01"+"\" method=\"post\" class=\"form-horizontal\"  target=\"_top\" accept-charset=\"UTF-8\"  action=\"${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"save.ac\">");
//		sb.append("\n\t\t\t\t  <s:token></s:token>");
		sb.append("\n\t\t\t\t  <input type=\"hidden\" name=\"bean.offset\" id=\"bean_offset\" value=\"${bean.offset}\">");
		//--主键字段列表--
		List<ColumsBean> pkColumsBeans=new ArrayList<ColumsBean>();
		//-----1-字段列表------
		for(int i=0;i<columsBeans.size();i++){
			ColumsBean colums=columsBeans.get(i);
			//是否主键
			if("PRI".equals(StrUtils.toUpperCase(colums.getColumsKey()))){
				pkColumsBeans.add(colums);
			}
		}
		String str="";
		if(pkColumsBeans!=null && pkColumsBeans.size()>0){
			for(ColumsBean columsBean:pkColumsBeans){
				str+="\n\t\t\t\t  <input type=\"hidden\" name=\"bean."+(StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}\" />");
			}
		}else{
			str+=("\n\t\t\t\t  <input type=\"hidden\" name=\"bean.id\" value=\"${bean.id}\" />");
		}
		sb.append(str);
		
		//-----1-字段列表------
		for(ColumsBean colums:columsBeans){
			//是否主键
			if("PRI".equals(StrUtils.toUpperCase(colums.getColumsKey()))){
				continue;
			}
			//过滤不需要在页面编辑的字段
			if(config.getBaseColumns()!=null 
					&& config.getBaseColumns().contains(StrUtils.toLowerCase(colums.getColumsName()))
					&& !(config.getBaseColumnsJspNeed().contains(StrUtils.toLowerCase(colums.getColumsName())))){
				continue;
			}
			//TODO 特殊字段处理 需要特殊编辑控件 
			if(table.getSpecialcolumns()!=null && table.getSpecialcolumns().get(colums.getColumsName())!=null){
				//字段编辑控件类型 0单行文本 1多行文本 2日期控件 3单项下拉选择框 4多项下拉选择框 5单项项 6多选项 7图片上传 8富文本编辑器(简单) 9富文本编辑器(完整)
				switch (table.getSpecialcolumns().get(colums.getColumsName())) {
					case "0":{// 0单行文本
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	 <label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t  <div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t      <input type=\"text\" class=\"form-control\" placeholder=\"请输入"+colums.getColumsNote()+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\"/>");
						sb.append("\n\t\t\t\t\t		 <span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t  </div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "1":{//1多行文本
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t   <div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t     <textarea class=\"form-control\" rows=\"3\" placeholder=\"请输入"+colums.getColumsNote()+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}</textarea>");
						sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t   </div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "2":{//2日期控件 
//						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
//						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
//						sb.append("\n\t\t\t\t\t  <div  class=\"input-group input-medium date date-picker col-md-2\" data-date-format=\"yyyy-mm-dd\" style=\"padding-right: 15px;padding-left: 15px;\">");//data-date-end-date=\"0d\" 
//						sb.append("\n\t\t\t\t\t 	<input class=\"form-control\" type=\"text\" placeholder=\"请输入"+colums.getColumsNote()+"\" readonly=\"readonly\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\">");
//						sb.append("\n\t\t\t\t\t		<span class=\"input-group-btn\">");
//						sb.append("\n\t\t\t\t\t		 <button class=\"btn default\" type=\"button\"><i class=\"fa fa-calendar\"></i></button>");
//						sb.append("\n\t\t\t\t\t		</span>");
//						sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
//						sb.append("\n\t\t\t\t\t  </div>");
//						sb.append("\n\t\t\t\t\t</div>");
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	 <label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t  <div class=\"col-md-3\">");
						sb.append("\n\t\t\t\t\t      <input type=\"text\" class=\"form-control laydate-icon\"  readonly=\"readonly\" onclick=\"laydate({istime: true, festival: true, istoday: true, format: 'YYYY-MM-DD hh:mm:ss'})\" placeholder=\"请输入"+colums.getColumsNote()+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\"/>");
						sb.append("\n\t\t\t\t\t	     <span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t  </div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "3":{//3单项下拉选择框
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	 <label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t	 <div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t		 <div class=\"input-group\">");
						sb.append("\n\t\t\t\t\t			<span class=\"input-group-addon\">");
						sb.append("\n\t\t\t\t\t			<i class=\"fa fa-flag\"></i>");
						sb.append("\n\t\t\t\t\t			</span>");
						sb.append("\n\t\t\t\t\t			<select name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" class=\"form-control select2 select2me\" data-placeholder=\"选择"+colums.getColumsNote()+"..\">");
						sb.append("\n\t\t\t\t\t					<optgroup label=\"信息分组示例\">");
						sb.append("\n\t\t\t\t\t							<option  value=\"0\">一条信息示例</option>");
						sb.append("\n\t\t\t\t\t					</optgroup>");
						sb.append("\n\t\t\t\t\t			</select>");
						sb.append("\n\t\t\t\t\t		</div>");
						sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "4":{//4多项下拉选择框
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t	 <div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t		 <div class=\"input-group\">");
						sb.append("\n\t\t\t\t\t			<span class=\"input-group-addon\">");
						sb.append("\n\t\t\t\t\t			<i class=\"fa fa-flag\"></i>");
						sb.append("\n\t\t\t\t\t			</span>");
						sb.append("\n\t\t\t\t\t			<select id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" class=\"form-control select2 select2me\" data-placeholder=\"选择"+colums.getColumsNote()+"..\" multiple>");
						sb.append("\n\t\t\t\t\t					<optgroup label=\"信息分组示例\">");
						sb.append("\n\t\t\t\t\t							<option  value=\"0\">一条信息示例</option>");
						sb.append("\n\t\t\t\t\t					</optgroup>");
						sb.append("\n\t\t\t\t\t			</select>");
						sb.append("\n\t\t\t\t\t		</div>");
						sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "5":{//5单选框
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t		<label><input type=\"radio\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"1\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"0\">"+colums.getColumsNote()+"</label>&nbsp; &nbsp; ");
						sb.append("\n\t\t\t\t\t		<label><input type=\"radio\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"2\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"1\">"+colums.getColumsNote()+" </label>&nbsp; &nbsp; ");
						sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "6":{//6多选项
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\" style=\"margin-top:5px;\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" >");
						sb.append("\n\t\t\t\t\t		<label> <input type=\"checkbox\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\"   value=\"1\"> "+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "7":{//7图片上传
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t <div class=\"portlet box btn default btn-block\">");
						sb.append("\n\t\t\t\t\t	<div class=\"portlet-title\">");
						sb.append("\n\t\t\t\t\t		<div class=\"caption\"  id=\"select-image-modal-"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\"><i class=\"fa fa-anchor\"></i><font color=\"#000\">点击上传["+colums.getColumsNote()+"]</font></div>");
						sb.append("\n\t\t\t\t\t		<div class=\"tools\">");
						sb.append("\n\t\t\t\t\t			<a href=\"javascript:;\" class=\"collapse\"></a>");
//						sb.append("\n\t\t\t\t\t			<a href=\"javascript:;\" class=\"remove\"></a>");
						sb.append("\n\t\t\t\t\t		</div>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t	<div class=\"portlet-body\" style=\"display: block; \">");
						sb.append("\n\t\t\t\t\t		<input id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\"  name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" type=\"hidden\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\">");
						sb.append("\n\t\t\t\t\t		<img id=\"img_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" alt=\"\" src=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\">");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t	<span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t </div>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "8":{//8富文本编辑器(简化)
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t		<textarea class=\"form-control\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" style=\"height: 300px;width: 100%;\">");
						sb.append("\n\t\t\t\t\t			${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}");
						sb.append("\n\t\t\t\t\t		</textarea>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "9":{//9富文本编辑器(完全)
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t		<textarea class=\"form-control\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" style=\"height: 300px;width: 100%;\">");
						sb.append("\n\t\t\t\t\t			${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}");
						sb.append("\n\t\t\t\t\t		</textarea>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t</div>");
						break;
					}
					case "10":{//10附件上传
						sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
						sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
						sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\">");
						sb.append("\n\t\t\t\t\t <div class=\"portlet box btn default btn-block\">");
						sb.append("\n\t\t\t\t\t	<div class=\"portlet-title\">");
						sb.append("\n\t\t\t\t\t		<div class=\"caption\"  id=\"select-file-modal-"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\"><i class=\"fa fa-anchor\"></i><font color=\"#000\">点击上传["+colums.getColumsNote()+"]</font></div>");
						sb.append("\n\t\t\t\t\t		<div class=\"tools\">");
						sb.append("\n\t\t\t\t\t			<a href=\"javascript:;\" class=\"collapse\"></a>");
//						sb.append("\n\t\t\t\t\t			<a href=\"javascript:;\" class=\"remove\"></a>");
						sb.append("\n\t\t\t\t\t		</div>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t	<div class=\"portlet-body\" style=\"display: block; \">");
						sb.append("\n\t\t\t\t\t      <input type=\"text\" class=\"form-control\" readonly=\"readonly\"  placeholder=\"请上传"+colums.getColumsNote()+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\"/>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
						sb.append("\n\t\t\t\t\t </div>");
						sb.append("\n\t\t\t\t\t	</div>");
						sb.append("\n\t\t\t\t\t</div>");
					}
					default:{
						break;
					}
				}
			}else{
				if(table.getSpecialcolumns()==null){
					table.setSpecialcolumns(new HashMap<String, String>());
				}
				//System.out.println(colums.getColumsName()+"=="+colums.getColumsType());
				if(colums.getColumsNote()!=null && colums.getColumsNote().contains("字典")){
					//3单项下拉选择框
					table.getSpecialcolumns().put(colums.getColumsName(), "3");
					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
					sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
					sb.append("\n\t\t\t\t\t	 <div class=\"col-md-8\">");
					sb.append("\n\t\t\t\t\t		 <div class=\"input-group\">");
					sb.append("\n\t\t\t\t\t			<span class=\"input-group-addon\">");
					sb.append("\n\t\t\t\t\t			<i class=\"fa fa-flag\"></i>");
					sb.append("\n\t\t\t\t\t			</span>");
					sb.append("\n\t\t\t\t\t			<select name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" class=\"form-control select2 select2me\" data-placeholder=\"选择"+colums.getColumsNote()+"..\">");
					sb.append("\n\t\t\t\t\t					<optgroup label=\"信息分组示例\">");
					sb.append("\n\t\t\t\t\t							<option  value=\"0\">一条信息示例</option>");
					sb.append("\n\t\t\t\t\t					</optgroup>");
					sb.append("\n\t\t\t\t\t			</select>");
					sb.append("\n\t\t\t\t\t		</div>");
					sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
					sb.append("\n\t\t\t\t\t	</div>");
					sb.append("\n\t\t\t\t\t</div>");
				}else
				if(colums.getColumsType().equals("text")){//9富文本编辑器(完全)
					//System.out.println("====================");
					table.getSpecialcolumns().put(colums.getColumsName(), "9");
					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
					sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
					sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\">");
					sb.append("\n\t\t\t\t\t		<textarea class=\"form-control\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" style=\"height: 300px;width: 100%;\">");
					sb.append("\n\t\t\t\t\t			${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}");
					sb.append("\n\t\t\t\t\t		</textarea>");
					sb.append("\n\t\t\t\t\t	</div>");
					sb.append("\n\t\t\t\t\t</div>");
				}else if(Validator.isIntNumber(colums.getColumsLength())&&Integer.parseInt(colums.getColumsLength())>100&&Integer.parseInt(colums.getColumsLength())<=1000){//1多行文本
					table.getSpecialcolumns().put(colums.getColumsName(), "1");
					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
					sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
					sb.append("\n\t\t\t\t\t   <div class=\"col-md-8\">");
					sb.append("\n\t\t\t\t\t     <textarea class=\"form-control\" rows=\"3\" placeholder=\"请输入"+colums.getColumsNote()+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}</textarea>");
					sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
					sb.append("\n\t\t\t\t\t   </div>");
					sb.append("\n\t\t\t\t\t</div>");
				}else if(Validator.isIntNumber(colums.getColumsLength())&&Integer.parseInt(colums.getColumsLength())>1000){//8简化
					table.getSpecialcolumns().put(colums.getColumsName(), "8");
					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
					sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
					sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\">");
					sb.append("\n\t\t\t\t\t		<textarea class=\"form-control\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" style=\"height: 300px;width: 100%;\">");
					sb.append("\n\t\t\t\t\t			${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}");
					sb.append("\n\t\t\t\t\t		</textarea>");
					sb.append("\n\t\t\t\t\t	</div>");
					sb.append("\n\t\t\t\t\t</div>");
				}else if(colums.getColumsType().equals("datetime")){//2日期
//					table.getSpecialcolumns().put(colums.getColumsName(), "2");
//					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
//					sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
//					sb.append("\n\t\t\t\t\t  <div  class=\"input-group input-medium date date-picker col-md-2\" data-date-format=\"yyyy-mm-dd\" style=\"padding-right: 15px;padding-left: 15px;\">");//data-date-end-date=\"0d\" 
//					sb.append("\n\t\t\t\t\t 	<input class=\"form-control\" type=\"text\" placeholder=\"请输入"+colums.getColumsNote()+"\" readonly=\"readonly\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\">");
//					sb.append("\n\t\t\t\t\t		<span class=\"input-group-btn\">");
//					sb.append("\n\t\t\t\t\t		 <button class=\"btn default\" type=\"button\"><i class=\"fa fa-calendar\"></i></button>");
//					sb.append("\n\t\t\t\t\t		</span>");
//					sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
//					sb.append("\n\t\t\t\t\t  </div>");
//					sb.append("\n\t\t\t\t\t</div>");
					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
					sb.append("\n\t\t\t\t\t	 <label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
					sb.append("\n\t\t\t\t\t  <div class=\"col-md-3\">");
					sb.append("\n\t\t\t\t\t      <input type=\"text\" class=\"form-control laydate-icon\" readonly=\"readonly\" onclick=\"laydate({istime: true, festival: true, istoday: true, format: 'YYYY-MM-DD hh:mm:ss'})\" placeholder=\"请输入"+colums.getColumsNote()+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\"/>");
					sb.append("\n\t\t\t\t\t	     <span class=\"help-block\"></span>");
					sb.append("\n\t\t\t\t\t  </div>");
					sb.append("\n\t\t\t\t\t</div>");
				}else if(colums.getColumsType().equals("boolean")){//5单选框
					table.getSpecialcolumns().put(colums.getColumsName(), "5");
					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
					sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
					sb.append("\n\t\t\t\t\t	<div class=\"col-md-8\">");
					sb.append("\n\t\t\t\t\t		<label><input type=\"radio\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"1\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"0\">false-"+colums.getColumsNote()+"</label>&nbsp; &nbsp; ");
					sb.append("\n\t\t\t\t\t		<label><input type=\"radio\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"2\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"1\">true-"+colums.getColumsNote()+" </label>&nbsp; &nbsp; ");
					sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
					sb.append("\n\t\t\t\t\t	</div>");
					sb.append("\n\t\t\t\t\t</div>");
				}else if(DbTypeUtils.isColumnType(DbTypeUtils.dbType.Mysql,colums.getColumsType())){//数字输入框
					
					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
					sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
					sb.append("\n\t\t\t\t\t  <div class=\"col-md-8\">");
					sb.append("\n\t\t\t\t\t      <input type=\"text\" class=\"form-control\" placeholder=\"请输入"+colums.getColumsNote()+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\"/>");
					sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
					sb.append("\n\t\t\t\t\t  </div>");
					sb.append("\n\t\t\t\t\t</div>");
					
				}else{
					sb.append("\n\t\t\t\t\t<div class=\"form-group\">");
					sb.append("\n\t\t\t\t\t	<label class=\"col-md-2 control-label\" for=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\">"+colums.getColumsNote()+"</label>");
					sb.append("\n\t\t\t\t\t  <div class=\"col-md-8\">");
					sb.append("\n\t\t\t\t\t      <input type=\"text\" class=\"form-control\" placeholder=\"请输入"+colums.getColumsNote()+"\" id=\"bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" name=\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\" value=\"${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"}\"/>");
					sb.append("\n\t\t\t\t\t		<span class=\"help-block\"></span>");
					sb.append("\n\t\t\t\t\t  </div>");
					sb.append("\n\t\t\t\t\t</div>");
				}
			}
		}
		sb.append("\n\t\t\t\t\t");
		sb.append("\n\t\t\t\t\t<div class=\"form-actions\">");
		sb.append("\n\t\t\t\t\t\t<div style=\"width: 100px;margin: 0 auto;\">");
		sb.append("\n\t\t\t\t\t\t<input class=\"btn btn-primary\" type=\"submit\" value=\"保存\" /> | <a href=\"javascript:;\" onclick=\"closeMyBoxLayer();\">返回</a>");
		sb.append("\n\t\t\t\t\t</div>");
		sb.append("\n\t\t\t\t\t</div>");
		sb.append("\n\t\t\t\t</form>");
		sb.append("\n\t\t\t</div>");
		sb.append("\n\t\t</div>");
		sb.append("\n\t</div>");
		sb.append("\n\t\t<!-- END CONTAINER -->");
//		sb.append("\n\t</div>");
		sb.append("\n\t<!-- BEGIN FOOTER -->");
		sb.append("\n\t<%@ include file=\""+includeDir+"include/footer.jsp\"%>");
		sb.append("\n\t<!-- END FOOTER -->");
		sb.append("\n<%@ include file=\""+includeDir+"include/public_last_js_css.jsp\"%>");
		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrapvalidator/vendor/bootstrap/js/bootstrap.min.js\"></script>");
		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrapvalidator/dist/js/bootstrapValidator.js\"></script>");
//		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js\"></script>");
//		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js\"></script>");
		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/select2/select2.min.js\"></script>");
//		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrap.admin.theme/assets/plugins/clockface/js/clockface.js\"></script>");
		sb.append("\n<script type=\"text/javascript\">");
		sb.append("\n$(document).ready(function() {");
		
		StringBuffer imguploadsb=null;
		String editorimg_flag=null;
		//-----1-字段列表------
		for(ColumsBean colums:columsBeans){
			//是否主键
			if("PRI".equals(StrUtils.toUpperCase(colums.getColumsKey()))){
				continue;
			}
			//过滤不需要在页面编辑的字段
			if(config.getBaseColumns()!=null 
					&& config.getBaseColumns().contains(StrUtils.toLowerCase(colums.getColumsName()))
					&& !(config.getBaseColumnsJspNeed().contains(StrUtils.toLowerCase(colums.getColumsName())))){
				continue;
			}
			//TODO 特殊字段处理 需要特殊编辑控件 
			if(table.getSpecialcolumns()!=null && table.getSpecialcolumns().get(colums.getColumsName())!=null){
				//字段编辑控件类型 0单行文本 1多行文本 2日期控件 3单项下拉选择框 4多项下拉选择框 5单项项 6多选项 7图片上传 8富文本编辑器(简单) 9富文本编辑器(完整)
				switch (table.getSpecialcolumns().get(colums.getColumsName())) {
					case "0":{// 0单行文本
						break;
					}
					case "1":{//1多行文本
						break;
					}
					case "2":{//2日期控件 
//						sb.append("\n\t try{$('#bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').datepicker();}catch(e){console.error(e);}");
						break;
					}
					case "3":{//3单项下拉选择框
						sb.append("\n\t try{$('#bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').select2({ placeholder: \"点击选择"+colums.getColumsNote()+"\", allowClear: true  });}catch(e){console.error(e);}");
						break;
					}
					case "4":{//4多项下拉选择框
						sb.append("\n\t try{$('#bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').select2({ placeholder: \"点击选择"+colums.getColumsNote()+"\", allowClear: true  });}catch(e){console.error(e);}");
						break;
					}
					case "5":{//5单选框
						break;
					}
					case "6":{//6多选项
						break;
					}
					case "7":{//7图片上传
						if(imguploadsb==null){
							imguploadsb=new StringBuffer();
						}
						if(editorimg_flag==null){
							imguploadsb.append("\n\t	//--图片[控件]");
							imguploadsb.append("\n\t	var editor = K.editor({");
							imguploadsb.append("\n\t		resizeType : 2,");
							imguploadsb.append("\n\t		uploadJson : '${basePath}/uploadFile?isrich=1',");
							imguploadsb.append("\n\t		fileManagerJson : '${basePath}/plugins/editor/jsp/file_manager_json.jsp',");
							imguploadsb.append("\n\t		allowFileManager : true");
							imguploadsb.append("\n\t	});");
						}else{
							editorimg_flag="已存在!";
						}
						imguploadsb.append("\n\t	//--上传["+colums.getColumsNote()+"]");
						imguploadsb.append("\n\t	K('#select-image-modal-"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').click(function() {");
						imguploadsb.append("\n\t		editor.loadPlugin('image',function() {");
						imguploadsb.append("\n\t			editor.plugin.imageDialog({");
						imguploadsb.append("\n\t				imageUrl : $('#img_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').attr('src'),clickFn : function(");
						imguploadsb.append("\n\t					url,title,width,height,border,align) {");
						imguploadsb.append("\n\t						$('#img_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').attr('src',url);");
						imguploadsb.append("\n\t						$('#bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').val(url);");
						imguploadsb.append("\n\t						editor.hideDialog();");
						imguploadsb.append("\n\t					}");
						imguploadsb.append("\n\t			});");
						imguploadsb.append("\n\t		});");
						imguploadsb.append("\n\t	});");
						
						break;
					}
					case "8":{//8富文本编辑器(简化)
						if(imguploadsb==null){
							imguploadsb=new StringBuffer();
						}
						imguploadsb.append("\n\t	//--编辑框(简化)["+colums.getColumsNote()+"]");
						imguploadsb.append("\n\t	K.create('#bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"', {");
						imguploadsb.append("\n\t        resizeType : 1,");
						imguploadsb.append("\n\t        allowPreviewEmoticons : false,");
						imguploadsb.append("\n\t        allowImageUpload : false,");
						imguploadsb.append("\n\t        items : [");
						imguploadsb.append("\n\t	       'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',");
						imguploadsb.append("\n\t	       'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',");
						imguploadsb.append("\n\t	       'insertunorderedlist', '|', 'emoticons', 'image', 'link']");
						imguploadsb.append("\n\t	});");
						break;
					}
					case "9":{//9富文本编辑器(完全)
						if(imguploadsb==null){
							imguploadsb=new StringBuffer();
						}
						imguploadsb.append("\n\t	//--编辑框(完整)["+colums.getColumsNote()+"]");
						imguploadsb.append("\n\t	K.create('#bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"', {");
						imguploadsb.append("\n\t		 resizeType : 2,");
						imguploadsb.append("\n\t		 uploadJson : '${basePath}/uploadFile?isrich=1',");
						imguploadsb.append("\n\t		 fileManagerJson : '${basePath}/plugins/editor/jsp/file_manager_json.jsp',");
						imguploadsb.append("\n\t		 allowFileManager : true");
						imguploadsb.append("\n\t	});");						break;
					}
					case "10":{//10文件上传
						if(imguploadsb==null){
							imguploadsb=new StringBuffer();
						}
						if(editorimg_flag==null){
							imguploadsb.append("\n\t	//--图片[控件]");
							imguploadsb.append("\n\t	var editor = K.editor({");
							imguploadsb.append("\n\t		resizeType : 2,");
							imguploadsb.append("\n\t		uploadJson : '${basePath}/uploadFile?isrich=1',");
							imguploadsb.append("\n\t		fileManagerJson : '${basePath}/plugins/editor/jsp/file_manager_json.jsp',");
							imguploadsb.append("\n\t		allowFileManager : true");
							imguploadsb.append("\n\t	});");
						}else{
							editorimg_flag="已存在!";
						}
						imguploadsb.append("\n\t	//--文件上传["+colums.getColumsNote()+"]");
						imguploadsb.append("\n\t	K('#select-file-modal-"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').click(function() {");
						imguploadsb.append("\n\t		editor.loadPlugin('insertfile', function() {");
						imguploadsb.append("\n\t			editor.plugin.fileDialog({");
						imguploadsb.append("\n\t				fileUrl : K('#bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').val(),");
						imguploadsb.append("\n\t				clickFn : function(url, title) {");
						imguploadsb.append("\n\t					K('#bean_"+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"').val(url);");
						imguploadsb.append("\n\t					editor.hideDialog();");
						imguploadsb.append("\n\t				}");
						imguploadsb.append("\n\t			});");
						imguploadsb.append("\n\t		});");
						imguploadsb.append("\n\t	});");
						break;
					}
					default:{
						break;
					}
				}
			}
		}
		
		if(imguploadsb!=null){
			sb.append("\n\tKindEditor.ready(function(K) {");
			sb.append(imguploadsb);
			sb.append("\n\t});");
		}
		
		sb.append("\n\t$('#"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"_01"+"').bootstrapValidator({");
		sb.append("\n\t\tmessage: 'This value is not valid',");
		sb.append("\n\t\tfeedbackIcons: {");
		sb.append("\n\t\t\tvalid: 'glyphicon glyphicon-ok',");
		sb.append("\n\t\t\tinvalid: 'glyphicon glyphicon-remove',");
		sb.append("\n\t\t\tvalidating: 'glyphicon glyphicon-refresh'");
		sb.append("\n\t\t},");
		sb.append("\n\t\tfields: {");
		//-----1-字段列表------
		for(int i=0;i<columsBeans.size();i++){
			ColumsBean colums=columsBeans.get(i);
			//是否主键
			if("PRI".equals(StrUtils.toUpperCase(colums.getColumsKey()))){
				continue;
			}
			//过滤不需要在页面编辑的字段
			if(config.getBaseColumns()!=null 
					&& config.getBaseColumns().contains(StrUtils.toLowerCase(colums.getColumsName()))
					&& !(config.getBaseColumnsJspNeed().contains(StrUtils.toLowerCase(colums.getColumsName())))){
				continue;
			}
			
			StringBuffer valid_sb=new StringBuffer();
			boolean bl=false;
			
			valid_sb.append("\n\t\t\t\"bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),colums.getColumsName()))+"\": {");
			valid_sb.append("\n\t\t\t\t validators: {");
			if("NO".equals(StrUtils.toUpperCase(colums.getColumsIsNull()))){
				valid_sb.append("\n\t\t\t\t\tnotEmpty: {");
				valid_sb.append("\n\t\t\t\t\t\t message: '不能为空'");
				valid_sb.append("\n\t\t\t\t\t }");
				bl=true;
			}
			if(bl){
				valid_sb.append("\n\t\t\t\t\t ,");
			}
			if(DbTypeUtils.isColumnType(DbTypeUtils.dbType.Mysql,colums.getColumsType())){
					valid_sb.append("\n\t\t\t\t\t numeric: {");
					valid_sb.append("\n\t\t\t\t\t\t message: '必须是数字'");
					valid_sb.append("\n\t\t\t\t\t }");
					bl=true;
			}else{
				if(Validator.notEmpty(StrUtils.toUpperCase(colums.getColumsLength()))){
					valid_sb.append("\n\t\t\t\t\t stringLength: {");
					valid_sb.append("\n\t\t\t\t\t\t max: "+colums.getColumsLength()+",");
					valid_sb.append("\n\t\t\t\t\t\t message: '字符不能超过"+colums.getColumsLength()+"个'");
					valid_sb.append("\n\t\t\t\t\t }");
					bl=true;
				}
			}
			valid_sb.append("\n\t\t\t\t }");
			valid_sb.append("\n\t\t\t }");
			
			if(bl){
				sb.append(valid_sb);
				if(i<columsBeans.size()-1){
					sb.append("\n\t\t\t , ");
				}
			}
		}
		sb.append("\n\t\t}");
		sb.append("\n\t});");
		sb.append("\n});");
		sb.append("\n</script>");
		
		sb.append("\n</body>");
		sb.append("\n<!-- END BODY -->");
		sb.append("\n</html>");
		try {
			String package_name="";
			if(Validator.notEmpty(config.getThisJspDir())){
				package_name=StrUtils.replaceAll(config.getThisJspDir(), "\\.","/");
			}else{
				package_name=config.getActionPackage().substring(config.getActionPackage().lastIndexOf(".")+1,config.getActionPackage().length());
			}
			//文件保存路径 项目根目录+包路径+类名称
			String fileurl=config.getWebAppDir()+"/WEB-INF/pages/admin/"+package_name+"/";
			//创建文件夹
			File saveDirFile = new File(fileurl);
			if (!saveDirFile.exists()) {
				saveDirFile.mkdirs();
			}
			//写入文件
			PrintWriter pw=new PrintWriter(fileurl+"/"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"_01.jsp","utf8");
			pw.write(sb.toString());
			pw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return sb;
	}
	/**
	 * 生成 jsp 回收站页面
	 * @param config
	 * @return
	 */
	public static StringBuffer toFileRecycleJsp(ConfigBean config,TableBean table,String actionName,List<String> leftMenuList){
		try {
			len=Integer.parseInt(config.getJsplen());
		} catch (Exception e1) {
		}
		String includeDir="../";
		if(Validator.notEmpty(config.getThisJspDir())){
			int n=config.getThisJspDir().indexOf(".");
			for(int i=0;i<n-1;i++){
				includeDir+="../";
			}
		}
		StringBuffer sb=new StringBuffer("");
		sb.append("<%--");
		sb.append("\n/*");
		sb.append("\n * "+table.getTableNote()+" 后台管理 (回收站页面)");
		sb.append("\n *");
		sb.append("\n * VERSION  DATE\t\tBY\t\t   REASON");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * 1.00\t "+sdf.format(new Date())+"  "+config.getAuther()+"   程序.发布");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * "+config.getCopyright());
		sb.append("\n *");
		sb.append("\n */");
		sb.append("\n--%>");
		sb.append("\n<%@ page language=\"java\" contentType=\"text/html; charset=utf-8\" pageEncoding=\"utf-8\" session=\"false\"%>");
		sb.append("\n<%@page import=\""+config.getBasepackage()+".common.CommonConstant\"%>");
		sb.append("\n<%@ taglib uri=\"http://java.sun.com/jsp/jstl/core\" prefix=\"c\"%>");
		sb.append("\n<%@ taglib uri=\"http://java.sun.com/jsp/jstl/functions\" prefix=\"fn\"%>");
		sb.append("\n<%@ taglib prefix=\"customtag\" uri=\"/custom-tags\"%>");
		sb.append("\n<!DOCTYPE html>");
		sb.append("\n<!--[if IE 8]> <html lang=\"zh-CN\" class=\"ie8 no-js\"> <![endif]--><!--[if IE 9]> <html lang=\"zh-CN\" class=\"ie9 no-js\"> <![endif]--><!--[if !IE]><!--> <html lang=\"zh-CN\" class=\"no-js\"> <!--<![endif]-->");
		sb.append("\n<head>");
		sb.append("\n<meta charset=\"utf-8\" />");
		sb.append("\n<%@ include file=\""+includeDir+"include/meta.jsp\" %>");
		sb.append("\n<%@ include file=\""+includeDir+"include/admin_title.jsp\" %>");
		sb.append("\n<%@ include file=\""+includeDir+"include/public_init_js_css.jsp\" %>");
		
//		sb.append("\n<link rel=\"stylesheet\" href=\"${basePath}/plugins/bootstrapvalidator/vendor/bootstrap/css/bootstrap.css\"/>");
//		sb.append("\n");
//		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrapvalidator/vendor/jquery/jquery-1.10.2.min.js\"></script>");
//		sb.append("\n<script type=\"text/javascript\" src=\"${basePath}/plugins/bootstrapvalidator/vendor/bootstrap/js/bootstrap.min.js\"></script>");
		
		sb.append("\n");
		sb.append("\n</head>");
		sb.append("\n<!-- END HEAD -->");
		sb.append("\n<!-- BEGIN BODY -->");
		sb.append("\n<body class=\"page-header-fixed\">");
		sb.append("\n\t<!-- BEGIN HEADER -->");
		sb.append("\n\t<%@ include file=\""+includeDir+"include/header.jsp\"%>");
		sb.append("\n\t<!-- END HEADER -->");
		sb.append("\n\t<div class=\"clearfix\"></div>");
		sb.append("\n\t<!-- BEGIN CONTAINER -->");
		sb.append("\n\t<div class=\"page-container\">");
		
		sb.append("\n\t<!-- BEGIN SIDEBAR MENU -->        ");
//		sb.append("\n\t<ul class=\"page-sidebar-menu\">");
		StringBuffer leftMenu=new StringBuffer();
//		leftMenu.append("\n\t\t<li id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"\" class=\"\">");
//		leftMenu.append("\n\t\t\t<a class=\"active\" href=\"javascript:;\">");
//		leftMenu.append("\n\t\t\t<i class=\"fa fa-cogs\"></i> ");
//		leftMenu.append("\n\t\t\t<span class=\"title\">"+table.getTableNote()+"</span>");
//		leftMenu.append("\n\t\t\t<span id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_arrow\" class=\"arrow\"></span>");
//		leftMenu.append("\n\t\t\t</a>");
//		leftMenu.append("\n\t\t\t<ul id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu\" style=\"display: none;\" class=\"sub-menu\">");
		leftMenu.append("\n\t\t\t\t<li id=\""+config.getThisJspDir()+"_sub_menu_"+(leftMenuList.size()+1)+"\"><a href=\"${basePath }/h/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"recycle.ac\">"+table.getTableNote()+"【回收站】</a></li>");
//		leftMenu.append("\n\t\t\t\t<li id=\""+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+"_sub_menu_l2\"><a href=\"${basePath }/h/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"recycle.ac\">信息回收站</a></li>");
//		leftMenu.append("\n\t\t\t</ul>");
//		leftMenu.append("\n\t\t</li>");
		leftMenuList.add(leftMenu.toString());
//		sb.append(leftMenu);
//		sb.append("\n\t</ul>");
		sb.append("\n\t\t<%@ include file=\""+includeDir+"include/leftMenu.jsp\"%>");
		sb.append("\n\t<!-- END SIDEBAR MENU -->");
		
		sb.append("\n\t\t<script type=\"text/javascript\">");
		sb.append("\n\t\t\tjQuery(document).ready(function() {");
		sb.append("\n\t\t\t\t$('#"+config.getThisJspDir()+",#"+config.getThisJspDir()+"_sub_menu_"+(leftMenuList.size())+"').addClass('active');");
		sb.append("\n\t\t\t\t$('#"+config.getThisJspDir()+"_arrow').addClass('open');");
		sb.append("\n\t\t\t\t$('#"+config.getThisJspDir()+"_sub_menu').show();");
		sb.append("\n\t\t\t});");
		sb.append("\n\t\t</script>");
		
		sb.append("\n\t<!-- BEGIN PAGE -->");
		sb.append("\n\t<div class=\"page-content\">");
		sb.append("\n\t<!-- BEGIN STYLE CUSTOMIZER -->");
		sb.append("\n\t<%@ include file=\""+includeDir+"include/style_customizer.jsp\"%>");
		sb.append("\n\t<!-- END BEGIN STYLE CUSTOMIZER -->");
		sb.append("\n\t\t<!-- BEGIN PAGE HEADER-->");
		sb.append("\n\t\t<div class=\"row\">");
		sb.append("\n\t\t\t<div class=\"col-md-12\">");
		sb.append("\n\t\t\t\t<!-- BEGIN PAGE TITLE & BREADCRUMB-->");
		sb.append("\n\t\t\t\t<h3 class=\"page-title\">");
		sb.append("\n\t\t\t\t\t"+table.getTableNote()+"回收站 <small><span class=\"help-inline\">在这里你可以查看逻辑删除的信息</span></small>");
		sb.append("\n\t\t\t\t</h3>");
		sb.append("\n\t\t\t\t<ul class=\"page-breadcrumb breadcrumb\">");
		sb.append("\n\t\t\t\t\t<li><i class=\"fa fa-home\"></i> <a");
		sb.append("\n\t\t\t\t\t\thref=\"${basePath }/h/index.ac\">主页</a> <i");
		sb.append("\n\t\t\t\t\t\tclass=\"fa fa-angle-right\"></i></li>");
		sb.append("\n\t\t\t\t\t<li><a href=\"${basePath}/"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"init.ac\">"+table.getTableNote()+"管理</a> <i class=\"fa fa-angle-right\"></i></li>");
		sb.append("\n\t\t\t\t\t<li>回收站</li>");
		sb.append("\n\t\t\t\t</ul>");
		sb.append("\n\t\t\t\t<!-- END PAGE TITLE & BREADCRUMB-->");
		sb.append("\n\t\t\t</div>");
		sb.append("\n\t\t</div>");
		sb.append("\n\t\t<!-- END PAGE HEADER-->");
		sb.append("\n");
		sb.append("\n\t\t<!-- BEGIN PAGE CONTENT-->");
		sb.append("\n<!-- BEGIN PAGE CONTENT-->");
		sb.append("\n<div class=\"row\">");
		sb.append("\n\t<div class=\"col-md-12\">");
		sb.append("\n\t\t<div class=\"matter\">");
		
		sb.append("\n\t\t\t<table class=\"table table-striped table-bordered table-hover\" id=\"table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"\">");
		sb.append("\n\t\t\t\t<thead>");
		sb.append("\n\t\t\t\t\t<tr>");
		StringBuffer thsb=null;
		StringBuffer tdsb=null;
		int showcolumnssize=2;
		//需要使用js排序的td字段
		StringBuffer tdsort=null;
		if(table.getShowColumns()!=null){
			thsb=new StringBuffer();
			tdsb=new StringBuffer();
			tdsort=new StringBuffer();
			for(ColumsBean col:table.getShowColumns()){
				if(col!=null){
					thsb.append("\n\t\t\t\t\t\t<th class=\"col-md-"+(Validator.isIntNumber(col.getColmd())?col.getColmd():"1")+"\">"+col.getName()+"</th>");
					tdsb.append("\n\t\t\t\t\t\t<td>${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),col.getDbcolumns()))+"}</td>");
					tdsort.append("null");
					if(showcolumnssize-1<table.getShowColumns().size()-1){
						tdsort.append(",");
					}
					++showcolumnssize;
				}
			}
		}
		sb.append("\n\t\t\t\t\t\t<th class=\"col-md-1 table-checkbox\"><input type=\"checkbox\" class=\"group-checkable\" data-set=\"#table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+" .checkboxes\" /></th>");
		sb.append(thsb);
		sb.append("\n\t\t\t\t\t\t<th class=\"col-md-1\"></th>");
		sb.append("\n\t\t\t\t\t</tr>");
		sb.append("\n\t\t\t\t</thead>");
		sb.append("\n\t\t\t\t<tbody>");
		sb.append("\n\t\t\t<c:choose>");
		sb.append("\n\t\t\t\t<c:when test=\"${beans!=null && fn:length(beans)>0}\">");
		sb.append("\n\t\t\t\t<c:forEach items=\"${beans}\" var=\"bean\">");
		sb.append("\n\t\t\t\t\t<tr class=\"odd gradeX\">");
		//TODO 获取表字段列表
		List<ColumsBean> columsBeans=table.getColums();
		if(columsBeans==null){
			columsBeans=new ArrayList<ColumsBean>();
		}
		//--主键字段列表--
		List<ColumsBean> pkColumsBeans=new ArrayList<ColumsBean>();
		//-----1-字段列表------
		for(int i=0;i<columsBeans.size();i++){
			ColumsBean colums=columsBeans.get(i);
			//是否主键
			if("PRI".equals(StrUtils.toUpperCase(colums.getColumsKey()))){
				pkColumsBeans.add(colums);
			}
		}
		String strpk="";
		String str="";
		if(pkColumsBeans!=null && pkColumsBeans.size()>0){
			int i=0;
			for(ColumsBean columsBean:pkColumsBeans){
				strpk+="${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}";
				str+=(StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"=${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}");
				if(i<pkColumsBeans.size()-1){
					strpk+=("&");
					str+=("&");
				}
				i++;
			}
		}else{
			str+=("id=${bean.id}");
		}
		sb.append("\n\t\t\t\t\t\t<td><input name=\"pk\" type=\"checkbox\" class=\"checkboxes\" value=\""+strpk+"\" /></td>");
		sb.append(tdsb);
		sb.append("\n\t\t\t\t\t\t<td><a href=\"javascript:;\"   class=\"label label-danger\"  onclick=\"if(confirm('确认恢复吗?')){location.href='${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"recovery.ac?"+str+"'};\" rel=\"nofollow\"><i class=\"fa fa-mail-reply-all\"></i> 恢复</a>");
		sb.append("\n\t\t\t\t\t\t\t<a href=\"javascript:;\" class=\"label label-danger\"");
		sb.append("\n\t\t\t\t\t\t\tonclick=\"if(confirm('确认删除吗?删除后不能恢复')){location.href='${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"delph.ac?"+str+"'};\" rel=\"nofollow\"><i class=\"fa fa-fire\"></i> 彻底删除</a>");
		sb.append("\n\t\t\t\t\t\t</td>");
		sb.append("\n\t\t\t\t\t</tr>");
		sb.append("\n\t\t\t\t\t</c:forEach>");
		sb.append("\n\t\t\t\t	</c:when>");
		sb.append("\n\t\t\t\t	<c:otherwise>");
		sb.append("\n\t\t\t\t	<tr>");
		sb.append("\n\t\t\t\t		<td class=\"col-md-8\" colspan=\""+showcolumnssize+"\">");
		sb.append("\n\t\t\t\t			<div class=\"alert\"><strong>暂无数据!</strong></div>");
		sb.append("\n\t\t\t\t		</td>");
		sb.append("\n\t\t\t\t	</tr>");
		sb.append("\n\t\t\t\t	</c:otherwise>");
		sb.append("\n\t\t\t</c:choose>");
		sb.append("\n\t\t\t\t</tbody>");
		sb.append("\n\t\t\t</table>");
		sb.append("\n\t\t\t<customtag:pagingext func=\"loadUrlPage\" params=\"'"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"recycle'\" />");
		sb.append("\n\t\t</div>");
		sb.append("\n\t</div>");
		sb.append("\n</div>");
		sb.append("\n<!-- END PAGE CONTENT-->");
		sb.append("\n\t</div>");
		sb.append("\n\t</div>");
		sb.append("\n\t<!-- BEGIN FOOTER -->");
		sb.append("\n\t<%@ include file=\""+includeDir+"include/footer.jsp\"%>");
		sb.append("\n\t<!-- END FOOTER -->");
		sb.append("\n</body>");
		sb.append("\n<!-- END BODY -->");
		sb.append("\n</html>");
		sb.append("\n<%@ include file=\""+includeDir+"include/public_last_js_css.jsp\"%>");
		sb.append("\n<script type=\"text/javascript\">");
		sb.append("\n$(document).ready(function() {\n//js code \n");
		//js排序控件初始化
		sb.append("\n //表格排序功能  参数1:表格id 参数2:json格式 哪些列不参与排序 null为参与  参数3:数组 隐藏列[0,1]表示隐藏1,2列");
		sb.append("\n myTableManaged.init('table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"',[{ 'bSortable': false },"+tdsort+",{ 'bSortable': false }],[]);");
		sb.append("\n});");
		sb.append("\nfunction loadUrlPage(offset, url) {");
		sb.append("\n\tlocation.href='${basePath}' + url +'.ac?offset=' + offset;");
		sb.append("\n}");
		sb.append("\n</script>");
		
		try {
			String package_name="";
			if(Validator.notEmpty(config.getThisJspDir())){
				package_name=StrUtils.replaceAll(config.getThisJspDir(), "\\.","/");
			}else{
				package_name=config.getActionPackage().substring(config.getActionPackage().lastIndexOf(".")+1,config.getActionPackage().length());
			}
			//文件保存路径 项目根目录+包路径+类名称
			String fileurl=config.getWebAppDir()+"/WEB-INF/pages/admin/"+package_name+"/";
			//创建文件夹
			File saveDirFile = new File(fileurl);
			if (!saveDirFile.exists()) {
				saveDirFile.mkdirs();
			}
			//写入文件
			PrintWriter pw=new PrintWriter(fileurl+"/"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"_03.jsp","utf8");
			pw.write(sb.toString());
			pw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sb;
	}
	/**
	 * 生成 jsp 回收站页面 信息列表
	 * @param config
	 * @return
	 */
	public static StringBuffer toFileRecycleListJsp(ConfigBean config,TableBean table,String actionName){
		try {
			len=Integer.parseInt(config.getJsplen());
		} catch (Exception e1) {
		}
		StringBuffer sb=new StringBuffer("");
		sb.append("<%--");
		sb.append("\n/*");
		sb.append("\n * "+table.getTableNote()+" 后台管理 (回收站页面  信息列表)");
		sb.append("\n *");
		sb.append("\n * VERSION  DATE\t\tBY\t\t   REASON");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * 1.00\t "+sdf.format(new Date())+"  "+config.getAuther()+"   程序.发布");
		sb.append("\n * -------- ----------- ------------ ------------------------------------------");
		sb.append("\n * "+config.getCopyright());
		sb.append("\n *");
		sb.append("\n */");
		sb.append("\n--%>");
		sb.append("\n<%@ page language=\"java\" contentType=\"text/html; charset=utf-8\" pageEncoding=\"utf-8\" session=\"false\"%>");
		sb.append("\n<%@page import=\""+config.getBasepackage()+".common.CommonConstant\"%>");
		sb.append("\n<%@ taglib uri=\"http://java.sun.com/jsp/jstl/core\" prefix=\"c\"%>");
		sb.append("\n<%@ taglib uri=\"http://java.sun.com/jsp/jstl/functions\" prefix=\"fn\"%>");
		sb.append("\n<%@ taglib prefix=\"customtag\" uri=\"/custom-tags\"%>");
		sb.append("\n\t\t<div class=\"matter\">");
		
		sb.append("\n\t\t\t<table class=\"table table-striped table-bordered table-hover\" id=\"table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"\">");
		sb.append("\n\t\t\t\t<thead>");
		sb.append("\n\t\t\t\t\t<tr>");
		StringBuffer thsb=null;
		StringBuffer tdsb=null;
		int showcolumnssize=2;
		//需要使用js排序的td字段
		StringBuffer tdsort=null;
		if(table.getShowColumns()!=null){
			thsb=new StringBuffer();
			tdsb=new StringBuffer();
			tdsort=new StringBuffer();
			for(ColumsBean col:table.getShowColumns()){
				if(col!=null){
					thsb.append("\n\t\t\t\t\t\t<th class=\"col-md-"+(Validator.isIntNumber(col.getColmd())?col.getColmd():"1")+"\">"+col.getName()+"</th>");
					tdsb.append("\n\t\t\t\t\t\t<td>${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),col.getDbcolumns()))+"}</td>");
					tdsort.append("null");
					if(showcolumnssize-2<table.getShowColumns().size()-1){
						tdsort.append(",");
					}
					++showcolumnssize;
				}
			}
		}
		sb.append("\n\t\t\t\t\t\t<th class=\"col-md-1 table-checkbox\"><input type=\"checkbox\" class=\"group-checkable\" data-set=\"#table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+" .checkboxes\" /></th>");
		sb.append(thsb);
		sb.append("\n\t\t\t\t\t\t<th class=\"col-md-1\"></th>");
		sb.append("\n\t\t\t\t\t</tr>");
		sb.append("\n\t\t\t\t</thead>");
		sb.append("\n\t\t\t\t<tbody>");
		sb.append("\n\t\t\t<c:choose>");
		sb.append("\n\t\t\t\t<c:when test=\"${beans!=null && fn:length(beans)>0}\">");
		sb.append("\n\t\t\t\t<c:forEach items=\"${beans}\" var=\"bean\">");
		sb.append("\n\t\t\t\t\t<tr class=\"odd gradeX\">");
		//TODO 获取表字段列表
		List<ColumsBean> columsBeans=table.getColums();
		if(columsBeans==null){
			columsBeans=new ArrayList<ColumsBean>();
		}
		//--主键字段列表--
		List<ColumsBean> pkColumsBeans=new ArrayList<ColumsBean>();
		//-----1-字段列表------
		for(int i=0;i<columsBeans.size();i++){
			ColumsBean colums=columsBeans.get(i);
			//是否主键
			if("PRI".equals(StrUtils.toUpperCase(colums.getColumsKey()))){
				pkColumsBeans.add(colums);
			}
		}
		String strpk="";
		String str="";
		if(pkColumsBeans!=null && pkColumsBeans.size()>0){
			int i=0;
			for(ColumsBean columsBean:pkColumsBeans){
				strpk+="${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}";
				str+=(StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"=${bean."+StrUtils.toLowerCaseFirstOne(HeaderUtils.getStr(config.getIsformat(),columsBean.getColumsName()))+"}");
				if(i<pkColumsBeans.size()-1){
					strpk+=("&");
					str+=("&");
				}
				i++;
			}
		}else{
			str+=("id=${bean.id}");
		}
		sb.append("\n\t\t\t\t\t\t<td><input name=\"pk\" type=\"checkbox\" class=\"checkboxes\" value=\""+strpk+"\" /></td>");
		sb.append(tdsb);
		sb.append("\n\t\t\t\t\t\t<td><a href=\"javascript:;\"   class=\"label label-primary\"  onclick=\"if(confirm('确认恢复吗?')){location.href='${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"recovery.ac?"+str+"'};\" rel=\"nofollow\"><i class=\"fa fa-mail-reply-all\"></i> 恢复</a>");
		sb.append("\n\t\t\t\t\t\t\t<a href=\"javascript:;\" class=\"label label-danger\"");
		sb.append("\n\t\t\t\t\t\t\tonclick=\"if(confirm('确认删除吗?删除后不能恢复')){location.href='${basePath}"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"delph.ac?"+str+"'};\" rel=\"nofollow\"><i class=\"fa fa-fire\"></i> 彻底删除</a>");
		sb.append("\n\t\t\t\t\t\t</td>");
		sb.append("\n\t\t\t\t\t</tr>");
		sb.append("\n\t\t\t\t\t</c:forEach>");
		sb.append("\n\t\t\t\t	</c:when>");
		sb.append("\n\t\t\t\t	<c:otherwise>");
		sb.append("\n\t\t\t\t	<tr>");
		sb.append("\n\t\t\t\t		<td class=\"col-md-8\" colspan=\""+showcolumnssize+"\">");
		sb.append("\n\t\t\t\t			<div class=\"alert\"><strong>暂无数据!</strong></div>");
		sb.append("\n\t\t\t\t		</td>");
		sb.append("\n\t\t\t\t	</tr>");
		sb.append("\n\t\t\t\t	</c:otherwise>");
		sb.append("\n\t\t\t</c:choose>");
		sb.append("\n\t\t\t\t</tbody>");
		sb.append("\n\t\t\t</table>");
		sb.append("\n\t\t\t<customtag:pagingext func=\"loadUrlPage\" params=\"'"+strutsNamespace+"/"+StrUtils.toLowerCaseFirstOne(actionName).substring(0,len)+config.getActionJoin()+"recycle'\" />");
		sb.append("\n\t\t</div>");
		sb.append("\n<script type=\"text/javascript\">");
		sb.append("\n$(document).ready(function() {\n//js code \n");
		//js排序控件初始化
		sb.append("\n //表格排序功能  参数1:表格id 参数2:json格式 哪些列不参与排序 null为参与  参数3:数组 隐藏列[0,1]表示隐藏1,2列");
		sb.append("\n myTableManaged.init('table_"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"',[{ 'bSortable': false },"+tdsort+",{ 'bSortable': false }],[]);");
		sb.append("\n});");
		sb.append("\n</script>");
		
		try {
			String package_name="";
			if(Validator.notEmpty(config.getThisJspDir())){
				package_name=StrUtils.replaceAll(config.getThisJspDir(), "\\.","/");
			}else{
				package_name=config.getActionPackage().substring(config.getActionPackage().lastIndexOf(".")+1,config.getActionPackage().length());
			}
			//文件保存路径 项目根目录+包路径+类名称
			String fileurl=config.getWebAppDir()+"/WEB-INF/pages/admin/"+package_name+"/";
			//创建文件夹
			File saveDirFile = new File(fileurl);
			if (!saveDirFile.exists()) {
				saveDirFile.mkdirs();
			}
			//写入文件
			PrintWriter pw=new PrintWriter(fileurl+"/"+StrUtils.toLowerCaseFirstOne(StrUtils.toUpperCaseFirstOne(actionName).substring(0,len))+"_03_list.jsp","utf8");
			pw.write(sb.toString());
			pw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sb;
	}
}
